#include "SysCommons.h"
#include "Element.h"
#include "Table.h"

#include "Document.h"

#include "Utils.h"

Document::Document() {

}

Document::Document(std::istream &fin) {
	load(fin);
}

void Document::load(std::istream &fin) {
	char in_char;
	std::string str = "";
	while(fin >> in_char) {
		str += in_char;
		if(str == "[") {
			str.clear();
			std::cout << "read Table \n";
			attachChild(new Table(fin));
			in_char = -1;
		} else {
			throw parsing_error;
		}
	}
}